<?php
 
namespace StudyBuddy\Controllers;

use StudyBuddy\WebPage;
use StudyBuddy\CommentParser;
use StudyBuddy\Request;
use StudyBuddy\Responder;
use StudyBuddy\SubmittedCommentWWW;

/**
 * Controller for processing the "Like" action
 * on the comment
 *
 */
class Likecomment extends WebPage
{
	protected $membersOnly = true;

	protected $permission = 'vote';

	protected $aRequired = array('commentid');
	
	
	
	protected function main(){
		$this->oRegistry->registerObservers('INPUT_FILTERS');
		
		$oParser = new CommentParser($this->oRegistry);
		$oParser->addLike(new SubmittedCommentWWW($this->oRegistry));
		
		$this->returnResult();
	}
	
	
	protected function returnResult(){
		if(Request::isAjax()){
			Responder::sendJSON(array());
		}
		
		Responder::redirectToPage();
	}
}
